// 记录全局typeOption
// const typeCount = 10
// let typeOptionAll = {}
// function getAllType(type, value) {
//     let res = []
//     for(let i = 0; i < typeCount; i++) {
//         res.push({ label: `${type}${i}`, value: `${value}${i}` })
//     }
//     return res
// }
// typeOptionAll = {
//     String: getAllType('String', 's'),
//     Double: getAllType('Double', 'd'),
//     Integer: getAllType('Integer', 'i'),
//     Boolean: getAllType('Boolean', 'b'),
//     DateTime: getAllType('DateTime', 't')
// }
// console.log(JSON.stringify(typeOptionAll, null, 4));

export const typeOptionAll = {
  String: [
    {
      label: 'String0',
      value: 's0',
    },
    {
      label: 'String1',
      value: 's1',
    },
    {
      label: 'String2',
      value: 's2',
    },
    {
      label: 'String3',
      value: 's3',
    },
    {
      label: 'String4',
      value: 's4',
    },
    {
      label: 'String5',
      value: 's5',
    },
    {
      label: 'String6',
      value: 's6',
    },
    {
      label: 'String7',
      value: 's7',
    },
    // {
    //   label: 'String8',
    //   value: 's8',
    // },
    // {
    //   label: 'String9',
    //   value: 's9',
    // },
  ],
  Double: [
    {
      label: 'Double0',
      value: 'd0',
    },
    {
      label: 'Double1',
      value: 'd1',
    },
    {
      label: 'Double2',
      value: 'd2',
    },
    {
      label: 'Double3',
      value: 'd3',
    },
    {
      label: 'Double4',
      value: 'd4',
    },
    {
      label: 'Double5',
      value: 'd5',
    },
    {
      label: 'Double6',
      value: 'd6',
    },
    {
      label: 'Double7',
      value: 'd7',
    },
    // {
    //   label: 'Double8',
    //   value: 'd8',
    // },
    // {
    //   label: 'Double9',
    //   value: 'd9',
    // },
  ],
  Integer: [
    {
      label: 'Integer0',
      value: 'i0',
    },
    {
      label: 'Integer1',
      value: 'i1',
    },
    {
      label: 'Integer2',
      value: 'i2',
    },
    {
      label: 'Integer3',
      value: 'i3',
    },
    {
      label: 'Integer4',
      value: 'i4',
    },
    {
      label: 'Integer5',
      value: 'i5',
    },
    {
      label: 'Integer6',
      value: 'i6',
    },
    {
      label: 'Integer7',
      value: 'i7',
    },
    // {
    //   label: 'Integer8',
    //   value: 'i8',
    // },
    // {
    //   label: 'Integer9',
    //   value: 'i9',
    // },
  ],
  Boolean: [
    {
      label: 'Boolean0',
      value: 'b0',
    },
    {
      label: 'Boolean1',
      value: 'b1',
    },
    {
      label: 'Boolean2',
      value: 'b2',
    },
    {
      label: 'Boolean3',
      value: 'b3',
    },
    {
      label: 'Boolean4',
      value: 'b4',
    },
    {
      label: 'Boolean5',
      value: 'b5',
    },
    {
      label: 'Boolean6',
      value: 'b6',
    },
    {
      label: 'Boolean7',
      value: 'b7',
    },
    // {
    //   label: 'Boolean8',
    //   value: 'b8',
    // },
    // {
    //   label: 'Boolean9',
    //   value: 'b9',
    // },
  ],
  DateTime: [
    {
      label: 'DateTime0',
      value: 't0',
    },
    {
      label: 'DateTime1',
      value: 't1',
    },
    {
      label: 'DateTime2',
      value: 't2',
    },
    {
      label: 'DateTime3',
      value: 't3',
    },
    {
      label: 'DateTime4',
      value: 't4',
    },
    {
      label: 'DateTime5',
      value: 't5',
    },
    {
      label: 'DateTime6',
      value: 't6',
    },
    {
      label: 'DateTime7',
      value: 't7',
    },
    // {
    //   label: 'DateTime8',
    //   value: 't8',
    // },
    // {
    //   label: 'DateTime9',
    //   value: 't9',
    // },
  ],
}

export const batchConfig = {
  nameListPlace: `从excel直接复制 "数据项名称、数据项类型、数据项中文名" 三列，如下：
fieldName1	字符	字段描述1
fieldName2	整型	字段描述2
fieldName3	浮点	字段描述3
fieldName4	布尔	字段描述4
fieldName5	时间	字段描述5`,
  typeMap: {
      '字符': 'String',
      '整型': 'Integer',
      '浮点': 'Double',
      '布尔': 'Boolean',
      '时间': 'DateTime',
  },
  approveFields: [
      {name: "fillFormPerson", comments: "填表人", defaultValue: "", type: "String", group: "other", code: "", },
      {name: "approver", comments: "审批人", defaultValue: "", type: "String", group: "other", code: "", },
      {name: "approveDate", comments: "审批日期", defaultValue: "", type: "DateTime", group: "other", code: "", },
      {name: "approvalOpinion", comments: "审批意见", defaultValue: "", type: "String", group: "other", code: "", },
      {name: "approvalStatus", comments: "审批状态", defaultValue: null, type: "Integer", group: "other", code: "", },
      {name: "levelType", comments: "当前审批阶段", defaultValue: 0, type: "Integer", group: "other", code: "", },
      {name: "isApproved", comments: "是否审批通过", defaultValue: false, type: "Boolean", group: "other", code: "b7", },
  ],
  taxFields(hasTax, moneyIsAmount) {
    let res = [
      {name: "priceNonTax", comments: "非税单价", defaultValue: 0, type: "Double", group: "other", code: "", },
      {name: "price", comments: "含税单价", defaultValue: 0, type: "Double", group: "other", code: "", },
      {name: "taxRate", comments: "税率(%)", defaultValue: 1, type: "Double", group: "other", code: "", },
    ]
    hasTax && (res = res.concat([
      {name: this.moneyIsAmount ? "amount" : "moneyNonTax", comments: "非税金额", defaultValue: 0, type: "Double", group: "other", code: "", },
      {name: this.moneyIsAmount ? "amountTax" :"money", comments: "含税金额", defaultValue: 0, type: "Double", group: "other", code: "", },
    ]))
    return res
  },
  calcType(name) {
    let res = 'String'
    // type: String, Double, Integer, Boolean, DateTime

    if (/(价格|单价|金额|工资|补助|基数|扣款|税)/g.test(name)) {
      res = 'Double'
    } else if (/(数量|量|周期|时长|天数|id|ID)/g.test(name)) {
      res = 'Integer'
    } else if (/(是否|包含)/g.test(name)) {
      res = 'Boolean'
    } else if (/(日期)/g.test(name)) {
      res = 'DateTime'
    }

    return res
  },
}